﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
public partial class cart : OTS.MemberPage
{
    protected string strConent;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!TestLogin(HttpContext.Current))
        {
            Response.Redirect("index.aspx");
            return;
        }
        if (!Page.IsPostBack)
        {
            FillContent();
        }
    }
    private void FillContent()
    {
        OTS.BLL.CartBLL BLL = new OTS.BLL.CartBLL();
        OTS.Model.custom custom = GetCustom(HttpContext.Current);
        DataTable dt = BLL.GetListByCusID(custom.cusID);
        StringBuilder str = new StringBuilder();

        if (dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                str.Append("<tr cartID=\"" + dr["cartID"].ToString() + "\">");
                str.Append(" <td><input type='checkbox' /></td>");
                str.Append(" <td>");
                str.Append("    <a style=\"border: 0 none;\" target=\"_blank\" href=\"product.aspx?proID=" + dr["proID"].ToString() + " \">");
                if (dr["bigImg_pic"].ToString()=="")
                {
                    str.Append("<img height='50' width='33' src='img/yes_picture.gif' />");
                }
                else
                {
                    str.Append("<img height='50' width='33' src='" + PictureProcessing.ImgPathToThumbURL(dr["bigImg_pic"].ToString()) + "' />");
                }
                str.Append("</a>");
                str.Append(" </td>");
                str.Append(" <td style=\"text-align: left;\" >");
                str.Append("    <a style=\"border: 0 none;\" target=\"_blank\" href=\"product.aspx?proID=" + dr["proID"].ToString() + " \">");
                str.Append(dr["title"].ToString());
                str.Append("    </a>");
                str.Append(" </td>");
                str.Append(" <td>");
                str.Append(dr["sizeName"].ToString());
                str.Append(" </td>");
                str.Append(" <td>");
                str.Append(dr["col_color"].ToString());
                str.Append(" </td>");
                str.Append(" <td class=\"mktprice1\">");
                str.Append(dr["wholeSalePrice"].ToString());
                str.Append(" </td>");
                str.Append(" <td>");
                str.Append(dr["retailPrice"].ToString());
                str.Append(" </td>");
                str.Append(" <td ><div class=\"Numinput\">");
                str.Append("    <input class=\"_x_ipt textcenter\" type=\"text\"   size=\"3\" onchange=\"ItemNumUpdate(this);\" value=\"" + dr["pCount"].ToString() + "\" /> ");
                str.Append("        <span class=\"numadjust increase\" onclick=\"ItemNumAdd(this,1)\">");
                str.Append("        </span><span class=\"numadjust decrease\" onclick=\"ItemNumAdd(this,-1);\"></span></div>");

                str.Append(" </td>");
                str.Append(" <td class=\"itemTotal fontcolorRed\">");
                str.Append(" </td>");
                str.Append(" <td>");
                str.Append(" <a href=\"javascript:DeleteCart(" + dr["cartID"].ToString() + ",this);\" style='cursor:hand;'> 删除</a>");
                str.Append(" </td>");
                str.Append("</tr>");
            }

            strConent = str.ToString();
        }
        else
        {
            this.panelNoCart.CssClass = "divDisplayB";
            this.panelYesCart.CssClass = "divDisplayN";
        }
    }
}
